// inspect the convergence of the numerical integration in claculating the
// cross sections
// the data format is in 'b int(b)'
// by Asia Sun, Jul. 8, 2022

static int co = 0; // graph color
void primp(TGraph *g); // primp the graph

void str(){
  TLegend *lg = new TLegend(0.5, 0.6, 0.85, 0.89); lg->SetBorderSize(0);
  TGraph *gstr = new TGraph("str.txt", "%lg %lg");
  primp(gstr); lg->AddEntry(gstr, "\\frac{d\\sigma_{str}}{db}");
  TGraph *gdiff = new TGraph("diff.txt", "%lg %lg");
  primp(gdiff); lg->AddEntry(gdiff, "\\frac{d\\sigma_{diff}}{db}");
  TGraph *gzint = new TGraph("zint.txt", "%lg %lg");
  primp(gzint); lg->AddEntry(gzint, "|R_{l}(r)P_{lm}(cos\\theta)|^2");

  TCanvas *c = new TCanvas("c", "c", 800, 600);
  gstr->Draw();
  gdiff->Draw("same"); gzint->Draw("same");
  lg->Draw();

  c->Print("str.pdf");
} // end main function mom

// primp the graph
void primp(TGraph *g){
  TAxis *ax = g->GetXaxis(); ax->SetTitle("b [fm]"); ax->CenterTitle();
  TAxis *ay = g->GetYaxis(); ay->SetTitle("d\\sigma_{str}/db [fm]"); ay->CenterTitle();
  co++;
  if(5 == co || 10 == co) co++;
  g->SetLineColor(co); g->SetMarkerColor(co); g->SetLineWidth(2);
} // end function primp
